Skip to content

Add Echo body cache middleware - #6

Open
Obvidio wants to merge 2 commits into
RoseMark45:mainfrom
Obvidio:fix-body-cache-bind-restore
Open

Add Echo body cache middleware#6
Obvidio wants to merge 2 commits into
RoseMark45:mainfrom
Obvidio:fix-body-cache-bind-restore

Conversation

@Obvidio

@Obvidio Obvidio commented Aug 1, 2026

Copy link
Copy Markdown

Summary

  • add an opt-in BodyCache middleware that stores the original request body with a configurable max size
  • add a CachedBinder wrapper that restores c.Request().Body after c.Bind() so downstream handlers can read it again
  • cover JSON, XML, form-encoded, empty body, oversized body, and RawBody copy behavior

/claim #1

Testing

  • Not run locally: Go is not installed in this environment.

@Obvidio

Obvidio commented Aug 1, 2026

Copy link
Copy Markdown
Author

Update: I added go.sum and verified locally with Go 1.26.5 on Windows.

go test ./...
?    github.com/RoseMark45/echo [no test files]
ok   github.com/RoseMark45/echo/middleware 1.471s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant